const baseUrl: string = `https://fzz9881.wzqzs.top/open/components`;

interface RequestOptions {
  url: string;
  data?: any;
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
}

export function myRequest(option: RequestOptions = { url: '' }) {
  return new Promise((resolve, reject) => {
    uni.request({
      url: baseUrl + option.url,
      data: option.data,
      method: option.method || 'GET',
      success: (result) => {
        resolve(result);
      },
      fail: (error) => {
        reject(error);
      },
    });
  });
}
